#define _CRT_SECURE_NO_WARNINGS 1

#include "Mystring.h"

namespace XDT
{
	void test1()
	{
		//string s1;
		//std::cin >> s1;
		//std::cout << s1 << std::endl;

		string s1("hello world");
		string s2(s1);

		string s3("xxxx");
		s1 = s3;

		std::cout << s1 << endl;
		std::cout << s2 << endl;
		std::cout << s3 << endl;
	}

	void test2()
	{
		string s1 = "abcd";
		string s2;
		s2 = s1;

		string s3 = "ddd";
		if (s3.empty())
		{
			std::cout << "empty" << std::endl;
		}
	}

	void test3()
	{
		string s1 = "abcd";
		//s1.reserve(100);
		std::cout << s1 << std::endl;
		std::cout << s1.capacity() << std::endl;
		s1.push_back('a');
		std::cout << s1 << std::endl;
		std::cout << s1.capacity() << std::endl;
		std::cout << s1[2] << std::endl;
		s1.append("hhhh");
		std::cout << s1 << std::endl;
		s1.clear();
		std::cout << s1 << std::endl;
		string s2 = "dhsu";
		s2.swap(s1);
		std::cout << "s1:" << s1 << std::endl;
		std::cout << "s2:" << s2 << std::endl;
		s2 += 'd';
		std::cout << "s2:" << s2 << std::endl;
		s2 += "dadad";
		std::cout << "s2:" << s2 << std::endl;
		const string s3 = "xdt";
		std::cout << s3[2] << std::endl;
	}


	void test4()
	{
		string s1 = "abcdef";
		std::cout << s1.find('g') << std::endl;
		std::cout << s1.find("cd") << std::endl;
		s1.insert(4, 'g');
		std::cout << s1 << std::endl;
		s1.insert(0, 'g');
		std::cout << s1 << std::endl;
		s1.insert(3, "ADC");
		std::cout << s1 << std::endl;
		s1.insert(0, "GFD");
		std::cout << s1 << std::endl;
		s1.erase(1, 2);
		std::cout << s1 << std::endl;
	}

	void test5()
	{
		string s1 = "abcd";
		string s2 = "abcd";

		if (s1 > s2)
		{
			std::cout << "yes" << std::endl;
		}

		if (s1 >= s2)
		{
			std::cout << "yes" << std::endl;
		}

		if (s1 != s2)
		{
			std::cout << "yes" << std::endl;
		}
	}

	void test6()
	{
		string s1 = "lxl";
		string s2 = "hhhhhhh";
		s1 = s2;
		std::cout << s1 << std::endl;
		std::cout << s2 << std::endl;
	}
}

//
int main()
{
	XDT::test1();
	//string s1 = "dashfh";
	//cout << s1 << endl;
	//cin >> s1;
	//cout << s1 << endl;


	return 0;
}

//int main()
//{
//	string s1 = to_string(1083);
//	string s2 = to_string(1083.4394);
//	cout << s1 << endl;
//	cout << s2 << endl;
//
//	int x = stoi(s1);
//	double s = stod(s2);
//	cout << x << endl;
//	cout << s << endl;
//	return 0;
//}